package com.example.shengyin.service.impl;


import com.example.shengyin.dao.SeekerMapper;
import com.example.shengyin.entity.Page;
import com.example.shengyin.entity.Seeker;
import com.example.shengyin.service.SeekerService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 应聘者Service业务层处理
 *
 * @author ruoyi
 * @date 2023-08-03
 */
@Service
public class SeekerServiceImpl implements SeekerService {

    @Autowired
    private SeekerMapper seekerMapper;

    /**
     * 查询应聘者
     *
     * @param id 应聘者主键
     * @return 应聘者
     */
    @Override
    public Seeker selectSeekerById(Long id) {
        return seekerMapper.selectSeekerById(id);
    }



    /**
     * 查询应聘者列表
     */

    @Override
    public Page selectSeekerList(@Param("page")int page, @Param("limit")int limit, String jname, String phone) {
        List<Seeker> seekers = seekerMapper.selectSeekerList(page, limit, jname, phone);
        int countTotall = seekerMapper.countTotall(jname, phone);
        return new Page(seekers,page,countTotall,limit);
    }

    @Override
    public int countTotall(String jname, String phone) {
        return seekerMapper.countTotall(jname,phone);
    }

    /**
     * 新增应聘者
     *
     * @param seeker 应聘者
     * @return 结果
     */
    @Override
    public int insertSeeker(Seeker seeker) {
        return seekerMapper.insertSeeker(seeker);
    }

    /**
     * 修改应聘者
     *
     * @param seeker 应聘者
     * @return 结果
     */
    @Override
    public int updateSeeker(Seeker seeker) {
        return seekerMapper.updateSeeker(seeker);
    }

    /**
     * 批量删除应聘者
     *
     * @param ids 需要删除的应聘者主键
     * @return 结果
     */
    @Override
    public int deleteSeekerByIds(Long[] ids) {
        return seekerMapper.deleteSeekerByIds(ids);
    }

    /**
     * 删除应聘者信息
     *
     * @param id 应聘者主键
     * @return 结果
     */
    @Override
    public int deleteSeekerById(Long id) {
        return seekerMapper.deleteSeekerById(id);
    }

    List<Seeker> selectByJobid(Integer jobid){
      return   seekerMapper.selectByJobid(jobid);
    };
}
